/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package filesTableModel;

import SessionBeans.web.beans.FileInfo;
import entities.File;
import entities.Rights;

/**
 *
 * @author Tomas
 */
public class TableItemFile extends TableItemAbstract<File>{

    protected FileInfo fileInfo;
    
    public TableItemFile(FileInfo fileInfo) {
        this.fileInfo = fileInfo;
        this.type = TableItemTypeEnum.FILE;
    }
    
    @Override
    public boolean isFolder() {
        return false;
    }

    @Override
    public String getName() {
        return fileInfo.getValue().getFileName();
    }

    @Override
    public String getLastChange() {
        return Utils.getChangeString(fileInfo.getChangeLog());
    }

    @Override
    public String getSize() {
        return Utils.getSizeString(fileInfo);
    }

    @Override
    public File getValue() {
        return fileInfo.getValue();
    }

    @Override
    public Long getId() {
        return fileInfo.getValue().getId();
    }

    @Override
    public String getOwner() {
        return fileInfo.getOwner().getUserName();
    }

    @Override
    public String getRigtsString() {
        return fileInfo.getRights().getType();
    }

    @Override
    public boolean isShared() {
        return false;
    }    

    @Override
    public Rights getRigts() {
        return fileInfo.getRights();
    }
    
}
